#ifndef __UNTIL_ECL_H_INCLUDED__
#define __UNTIL_ECL_H_INCLUDED__

extern char line[];
extern int icmd;

#define MAXARGS (24)
typedef struct tagCMDLINE {
  int   nargs;
  char *arg[MAXARGS];
  int   len[MAXARGS];
} CMDLINE;

typedef struct tagCMDS {
  const char * const cmd;
  const char * const cmd_help;
  const struct tagCMDS * const prev;
  const struct tagCMDS * const next;
  int (*CmdHandler)( int keyc, char *keyv[], int keyl[] );
} CMDS;

enum CMD_RETURNS {
  CMD_SUCCESS=0,
  CMD_TOO_FEW_ARGS,
  CMD_INVALID_ARGS,
  CMD_FAILURE,
};

extern CMDLINE cmdline;

// extern int ECL_command_help( CMDS *cptr );
extern char *ECL_get_prompt( void );

extern int ECL_parser_init( CMDLINE *c, const CMDS *root_level );
extern int ECL_parse_command( char *line, CMDLINE *c );
extern int ECL_execute_command( int keyc, char *keyv[], int keyl[] );
extern int default_silly_func( int keyc, char *keyv[], int keyl[] );

extern int get_i32( char *val, int keyl, int32_t *i32, int32_t min, int32_t max, int32_t def );
extern int get_u32( char *val, int keyl, uint32_t *ui32, uint32_t min, uint32_t max, uint32_t def );
//extern int get_dbl( char *val, int keyl, double *dblval, uint32_t dblmin, uint32_t dblmax, uint32_t dbldef );
extern uint8_t IntToChar(int value,char *str,int radix);

extern const CMDS config_cmds[];
extern const CMDS cmds[];
extern const CMDS top[];

extern void Cmd_Handle_Process(void);

#endif
